package com.bmw.imageBlog.bmImage.service;

import java.util.List;

import com.bmw.imageBlog.bmImage.domain.BmImage;
import com.bmw.imageBlog.bmImage.mapper.BmImageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Service类
 * 
 * @author Jinmy
 * @date 2019-03-08 03:02:16
 */
@Service
public class BmImageService {

    @Autowired
    private BmImageMapper bmImageMapper;



    /**
     * 获取当前对象实例
     * <p><b>
     * 为了记录操作日志</br>
     * 在调用内部 add()、delete()、update()方法时候请这样书写 "this.currentProxy().add()"
     * </b></p>
     * 
     */
//    public BmImageService currentProxy() {
//        return SpringContextUtils.getBean(BmImageService.class);
//    }

    /**
     * 新增实体类到数据库
     * 
     */
    @Transactional
    public int add(BmImage record) {
        return bmImageMapper.add(record);
    }

    /**
     * 根据主键删除该记录
     * 
     */
    @Transactional
    public int delete(Integer id) {
        return bmImageMapper.delete(id);
    }

    /**
     * 根据主键修改该记录
     * 
     */
    @Transactional
    public int update(BmImage record) {
        return bmImageMapper.update(record);
    }

    /**
     * 根据主键查询该记录
     * 
     */
    public BmImage findById(Integer id) {
        return bmImageMapper.findById(id);
    }

    /**
     * 根据查询条件进行模糊查询
     * 
     */
    public List<BmImage> findLike(BmImage condition) {
        return bmImageMapper.findLike(condition);
    }

    /**
     * 根据查询条件进行匹配查询
     * 
     */
    public List<BmImage> findList(BmImage condition) {
        return bmImageMapper.findList(condition);
    }
}